package com.study.www.demo2filter.config;

import com.study.www.demo.Application;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.springframework.core.annotation.Order;
import org.springframework.web.filter.CompositeFilter;

import javax.annotation.PostConstruct;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.annotation.WebFilter;
import java.util.ArrayList;
import java.util.List;

/**
 * @author zhuyanpeng
 * @since 2020/1/10
 */
@Slf4j
@Order(1)
@WebFilter(urlPatterns = {"/demo/*"},dispatcherTypes = {DispatcherType.ASYNC,DispatcherType.REQUEST,DispatcherType.ERROR})
public class DemoCompositeFilter extends CompositeFilter {

    @PostConstruct
    public void postConstruct(){
        List<Filter> filters = new ArrayList<>();
        filters.add(new DemoFilter());
        filters.add(new Demo2Filter());
        super.setFilters(filters);
    }


}
